<style type="text/css">
.cal_heading {
	font-size: 14pt;
}

.highlight {
	color: #E42217;
}

#middle_column h2 {
	color: #BCC1DD;
}
</style>

<style type="text/css">
A:link {
	text-decoration: underline;
	color: #BCC1DD;
}

A:visited {
	text-decoration: none;
	color: #BCC1DD;
}

A:active {
	text-decoration: none
}

A:hover {
	font-size: 2430;
	font-weight: bold;
	color: #0099FF;
}
</style>

<h1>Calendar Page</h1>

<?php
if (isset($error)){
	echo $error;
}

$account = $this->session->userdata('account');
$access = $this->gateway_model->check_access($account);

echo "<div id='Date'>";

if (isset($calendar)){
	echo $calendar;
}

$months = array(
1 => 'January',
2 => 'February',
3 => 'March',
4 => 'April',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'August',
9 => 'September',
10 => 'October',
11 => 'November',
12 => 'December');

$years = array();
$today = getdate();
$month = $today['mon'];
$year = $today['year'];

for ($i=$year+1; $i >= 1996; $i--){
	$years[$i] = $i;
}

echo '</div>';
echo "<div style='position: relative' id='Date_Selector'>
<fieldset style='position: relative'><legend>Date Selector</legend>";

//Event creation/edit form
echo form_open('calendar/jump');
echo form_label('Year: ');
echo form_dropdown('year', $years, set_value('year', $year)) .br(2);
echo form_label('Month: ');
echo form_dropdown('month', $months, set_value('month', $month));
echo form_submit('submit', 'Jump');
echo form_close();

echo "</fieldset> </div>";


echo heading('<h1>'.'Events</h1>', 2);

if($access == 'account' || $access == 'admin' || $access == 'leader'){
echo anchor('/calendar/add_event', ' Create Event ') .br(2);
}

if (isset($events)){

	foreach($events as $i){

		echo "<div class=ui-accordion-header style='overflow: hidden;'>" .$i['title'] .'</div>';
		echo '<div class=ui-accordion-content>';
		echo '<p>Date:';

		echo $i['date'];
		if ($i['time'] != '00:00:00') {
			echo ' ' .'Time: '.$i['time'];
		}
		echo '</p>';

		echo br(1) .'Description:'.$i['description'] .br(1);
		if ($i['url'] != ''){
			echo $i['url'] .br(2);
		}
		if ($access == 'admin' || $access == 'leader'){
			echo anchor('/calendar/edit/'.$i['id'], 'Edit Event') .br(1);
		}
		echo '</div>';

	}
} else{
	echo '<p>There is currently no Event</p>';
}

?>